import java.util.HashSet;
import java.util.Set;

/**
 * @Title: ljblog_springboot
 * @Description: ()
 * @Author:lijie
 * @Version:1.1.0
 * @since 2022/1/10
 */
public class ThreadTest2 implements Runnable{
    private volatile static Integer i=0;
    private static Set<Integer> set=new HashSet<>();
    private String x;
    static ThreadLocal<String> localVar = new ThreadLocal<>();
    static void print(String str) {
        //打印当前线程中本地内存中本地变量的值
        System.out.println(str + " :" + localVar.get());
        //清除本地内存中的本地变量
        localVar.remove();
    }

    public static void main(String[] args) {

        Thread t2  = new Thread(new ThreadTest2("123"));
        Thread t3  = new Thread(new ThreadTest2("123"));
        System.out.println("1");
        t2.start();
        System.out.println("2");
        t3.start();
        System.out.println("3");
    }

    @Override
    public void run() {
        try{

                Thread.sleep(100);
            System.out.println("执行现场里的方法");
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    ThreadTest2(String x){
        this.x=x;
    }

}
